// pages/apiui/apiui.js
Page({

  /**
   * 页面的初始数据
   */
  data: {

  },
  showtoast: function() {
    wx.showToast({
      title: "操作成功",
      icon: "success",
      image: "/image/icon_API.png",
      mask: true
    })
  },
  showloading: function() {
    wx.showLoading({
      title: "加载中",
    })
    setTimeout(function() {
      wx.hideLoading()
    }, 2000)
    wx.showModal({
      title: '提示',
      content: '这是一个模态弹窗',
      success: function(res) {
        if (res.confirm) {
          console.log('用户点击确定')
        } else if (res.cancel) {
          console.log('用户点击取消')
        }
      }
    })
  },
  showActionSheet: function() {
    wx.showActionSheet({
      itemList: ['A', 'B', 'C'],
      success: function(res) {
        console.log(res.tapIndex)
      },
      fail: function(res) {
        console.log(res.errMsg)
      }
    })
  },
  setNavigationBarTitle: function() {
    wx.setNavigationBarTitle({
      title: '当前页面'
    })
    wx.showNavigationBarLoading(),
      wx.hideNavigationBarLoading()
  },
  mybindgetuserinfo: function(e) {
    console.log(e.detail.rawData)
  },
  authorize: function() {
    wx.authorize({
      scope: 'scope.userLocation',
      success:function(res){
        console.log(res)
      }
    })
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function(options) {
    console.log(options)
    wx.setNavigationBarTitle({
      title: options.title
    })
    wx.getUserInfo({
      success:function(e){
        console.log(e)
      }
    })
  },
  redirect: function() {
    wx.redirectTo({
      url: '/pages/request/request',
    })
  },
  switchtab: function() {
    wx.switchTab({
      url: '/pages/index/index',
    })
  },
  navigateback: function() {
    wx.navigateBack({

    })
  },
  relaunch: function() {
    wx.reLaunch({
      url: '/pages/request/request',
    })
  },
  onPullDownRefresh: function() {
    console.log("onPullDownRefresh")
  },
  startpull: function() {
    wx.startPullDownRefresh({

    })
  },
  stoppull: function() {
    wx.stopPullDownRefresh()
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function() {
    return {
      title: '自定义转发标题',
      path: '/pages/request/request',
      imageUrl:'/image/14-151120094951S5.jpg'
    }
  }
})